
#include <string.h>
#include "mq.h"

int main() {
	int mq_id = get_mq_id(); 
	
	struct msg_buffer buffer;
	int type;
	
	scanf("%d", &type);

	if(msgrcv(mq_id, &buffer, 1024, type, IPC_NOWAIT) == -1){
        perror("fail to recv message.");
        exit(1);
    }
    printf("received message type : %d, text: %s. \n", buffer.mtype, buffer.mtext);

	return 0;
}
